#pragma once
#include "udp_socket.hpp"

class UdpClient
{
	private:
		UdpSocket sock_;
		std::string ip_;
		uint16_t port_;
	public:
		UdpClient(const std::string& ip, uint16_t port):ip_(ip),port_(port)
	{
		assert(sock_.Socket());
	}
		~UdpClient()
		{
			sock_.Close();
		}
		bool Recvfrom(std::string* buf)
		{
			return sock_.Recvfrom(buf);
		}
		bool Sendto(const std::string& buf)
		{
			return sock_.Sendto(buf,ip_,port_);
		}
};

